//
//  NSString+NSString_Font.m
//  HJZWeiBo
//
//  Created by 蒋晨成 on 16/5/28.
//  Copyright © 2016年 蒋晨成. All rights reserved.
//

#import "NSString+Font.h"

@implementation NSString (Font)

- (CGFloat)getTextWidthWithFont:(UIFont *) font height:(CGFloat)height{
    CGSize size = [self boundingRectWithSize:CGSizeMake(0, height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : font} context:nil].size;
    return size.width;
}
- (CGFloat)getTextHeightWithFont:(UIFont *)font width:(CGFloat)width{
    CGSize size = [self boundingRectWithSize:CGSizeMake(width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : font} context:nil].size;
    return size.height;
}


@end
